function [M, V, B, G, J, dJ, Inv_J] = update_matrix_7_2(m, L, g, N, Ir, Bl, Br, theta1, theta2, omega1, omega2)
% 更新动力学矩阵
% M为广义质量矩阵，V为耦合系数矩阵，B为阻尼系数矩阵，G为空间重力矩阵

M = [m*(L^2)*(3 + 2*cos(theta2)) + Ir*(N^2), m*(L^2)*(1 + cos(theta2));
     m*(L^2)*(1 + cos(theta2)), m*(L^2) + Ir*(N^2)];
 
V = [0, (m * (L^2) * (2*omega1 + omega2)*sin(theta2));
     (m * (L^2) * omega1 * sin(theta2)), 0];
 
B = [Bl+Br*(N^2), 0;
     0, Bl+Br*(N^2)];

G = [(2*m*g*L*cos(theta1) + m*g*L*cos(theta1+theta2));
      m*g*L*cos(theta1+theta2)];
  
J = [-L*sin(theta1)-L*sin(theta1+theta2), -L*sin(theta1+theta2);
      L*cos(theta1)+L*cos(theta1+theta2),  L*cos(theta1+theta2)];
  
dJ = [-( L*cos(theta1)*omega1+L*cos(theta1+theta2)*(omega1+omega2)), -( L*cos(theta1+theta2)*(omega1+omega2));
       -( L*sin(theta1)*omega1+L*sin(theta1+theta2)*(omega1+omega2)), -( L*sin(theta1+theta2)*(omega1+omega2))];
Inv_J = inv(J);
